package opdracht4;

import static org.junit.Assert.*;

import org.junit.Test;

public class WeightedTreeTest extends TreeTest{

	@Test
	public void fillEmpty()
	{
		list = new WeightedSearchTree<Integer, String>();
		assertEquals("_", list.toString());
	}
	@Test
	public void testAdd_ManyElements()
	{
		super.testAdd_ManyElements();
		assertEquals("((_, (3, Gamma), (_, (4, Beta), _)), (5, Alfa), (_, (7, Elipson), (_, (8, Wau), _)))", list.toString());
	}
	@Test
	public void testAdd_ManyElementsCorrect()
	{
		testAdd_ManyElements();
		assertEquals("((_, (3, Gamma), (_, (4, Beta), _)), (5, Alfa), (_, (7, Elipson), (_, (8, Wau), _)))", list.toString());
	}
	@Test
	public void testAdd_AddSevenToRight()
	{
		super.testAdd_AddSevenToRight();
		assertEquals("(((_, (1, Alfa), _), (2, Beta), (_, (3, Gamma), _)), (4, Elipson), ((_, (5, Wau), _), (6, Theta), (_, (7, Omega), _)))", list.toString());
	}
	public void testAdd_AddSevenToRightCorrect()
	{
		testAdd_AddSevenToRight();
		assertEquals("(((_, (1, Alfa), _), (2, Beta), (_, (3, Gamma), _)), (4, Elipson), ((_, (5, Wau), _), (6, Theta), (_, (7, Omega), _)))", list.toString());
	}
	@Test
	public void testAdd_AddSevenToLeft()
	{
		super.testAdd_AddSevenToLeft();
		assertEquals("(((_, (1, Kappa), _), (2, Theta), (_, (3, Wau), _)), (4, Elipson), ((_, (5, Gamma), _), (6, Beta), (_, (7, Alfa), _)))", list.toString());
	}
	@Test
	public void testAdd_AddSevenToLeftCorrect()
	{
		testAdd_AddSevenToLeft();
		assertEquals("(((_, (1, Kappa), _), (2, Theta), (_, (3, Wau), _)), (4, Elipson), ((_, (5, Gamma), _), (6, Beta), (_, (7, Alfa), _)))", list.toString());
	}
	@Test
	public void testAdd_DoubleElement()
	{
		testAdd_ManyElements();
		list.put(3, "Gamma");
		assertEquals("((_, (3, Gamma), (_, (4, Beta), _)), (5, Alfa), (_, (7, Elipson), (_, (8, Wau), _)))", list.toString());
	}
	@Test
	public void testAdd_DoubleElement_END()
	{
		testAdd_ManyElements();
		list.put(5, "Alfa");
		assertEquals("((_, (3, Gamma), (_, (4, Beta), _)), (5, Alfa), (_, (7, Elipson), (_, (8, Wau), _)))", list.toString());
	}
	@Test
	public void testRemove_ManyElement()
	{
		testAdd_ManyElements();
		list.remove(7);
		assertEquals("((_, (3, Gamma), (_, (4, Beta), _)), (5, Alfa), (_, (8, Wau), _))", list.toString());
	}
	@Test
	public void testRemove_ManyElements_WRONG()
	{
		testAdd_ManyElements();
		list.remove(10);
		assertEquals("((_, (3, Gamma), (_, (4, Beta), _)), (5, Alfa), (_, (7, Elipson), (_, (8, Wau), _)))", list.toString());
	}
}
